<template>
  <a-form-item :name="formItem.name" :label="formItem.label" :rules="[formItem.rule]" :extra="formItem.extra"
    :style="{ marginLeft: formItem.marginLeft + 'px' }" class="form-a-radio-group">
    <a-tree-select :disabled="formItem.disabled" placeholder="请选择" v-model:value="formItem.value" show-search
      :dropdown-style="{ maxHeight: '200px', overflow: 'auto' }" allow-clear
      :fieldNames="{ children: 'children', label: 'channelName', value: 'id' }" tree-default-expand-all
      :tree-data="formItem.options" treeNodeFilterProp="channelName">
    </a-tree-select>
    <div class="help-msg" v-if="formItem.helpMsg">
      {{ formItem.helpMsg }}
    </div>
  </a-form-item>
</template>

<script lang="ts" setup>
import { ref, reactive, watch, computed } from "vue"
import { dataSourceType } from "@/type.d";
import { useColumnItem } from '@/components/draggable/hooks/useColumnModel';
const emit = defineEmits(['changeSelect'])
//props
const props = defineProps({
  formItem: {
    type: Object,
    default: {} as dataSourceType
  },


})
const formItem: any = ref(props.formItem as any);
useColumnItem(computed(() => props.formItem), formItem)
const changeSelect = (e: any) => {
  formItem.value = e.target.value;
  // emit('changeSelect', formItem.value)
};




</script>

<style lang="less" scoped>
::v-deep(.ant-select-single:not(.ant-select-customize-input) .ant-select-selector) {
  width: 100%;
}

.help-msg {
  margin-top: 8px;
  font-size: 12px;
  font-family: PingFang SC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.45);
  line-height: 20px;
}
</style>